﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FifaChamps.API.Data;

namespace FifaChamps.API.Data
{
    public static partial class DataManager
    {
        public static int Add_Fixture(string fixtureName)
        {
            using (var db = DataManager.FifaDB())
            {
                return db.SP_Add_Fixture(fixtureName).First().FixtureID.Value;
            }
        }

        public static int Add_FixtureResult(int fixtureID, int? resultType, int? goalsFor, int? goalsAgainst, bool? home)
        {
            using (var db = DataManager.FifaDB())
            {
                return db.SP_Add_FixtureResult(fixtureID, resultType, goalsFor, goalsAgainst, home).First().FixtureResultID.Value;
            }
        }

        public static int Add_FixtureResult_KOPlayer(int fixtureResultID, int knockoutplayerID)
        {
            using (var db = DataManager.FifaDB())
            {
                return db.SP_Add_FixtureResult_KnockoutPlayer(fixtureResultID, knockoutplayerID).First().ID.Value;
            }
        }

        public static int Add_FixtureResult_GroupPlayer(int fixtureResultID, int groupplayerID)
        {
            using (var db = DataManager.FifaDB())
            {
                return db.SP_Add_FixtureResult_GroupPlayer(fixtureResultID, groupplayerID).First().ID.Value;
            }
        }

        public static int Add_FixtureResult_SeasonPlayer(int fixtureResultID, int seasonplayerID)
        {
            using (var db = DataManager.FifaDB())
            {
                return db.SP_Add_FixtureResult_SeasonPlayer(fixtureResultID, seasonplayerID).First().ID.Value;
            }
        }

        public static int Update_FixtureResult(int id, int fixtureID, int? resultTypeID, int? goalsFor, int? goalsAgainst, bool? home)
        {
            using (var db = DataManager.FifaDB())
            {
                return db.SP_Update_FixtureResult(id, fixtureID, resultTypeID, goalsFor, goalsAgainst, home).First().ID.Value;
            }
        }
    }
}
